#include <iostream>
#include <string>
using namespace std;
int main()
{

    string f, s1, s2;
    cout << "Вести" << endl;
    cin >> f;
    for (char c: f) {
        if (c == '(') s1+=c;
        if (c == ')') {
            s2+=c;
            if  (s1.length() > 0) {
                if (s1[s1.length()-1] == '(') {
                    s1.pop_back();
                    s2.pop_back();
                    }
                }
            }
        if (c == '[') s1+=c;
        if (c == ']'){
            s2+=c;
            if  (s1.length() > 0) {
                if (s1[s1.length()-1] == '[') {
                    s1.pop_back();
                    s2.pop_back();
                    }
                }
            }
        if (c == '<') s1+=c;
        if (c == '>') {
            s2+=c;
            if  (s1.length() > 0) {
                if (s1[s1.length()-1] == '<') {
                    s1.pop_back();
                    s2.pop_back();
                }
            }
        }
    if (c == '{') s1+=c;
        if (c == '}') {
            s2+=c;
            if  (s1.length() > 0) {
                if (s1[s1.length()-1] == '{') {
                    s1.pop_back();
                    s2.pop_back();
                }
            }
        }



    }
    
    
    if (s1.length() == 0 and s2.length() == 0) cout << "true" << endl;
    else cout << "false" << endl;
    return 0;
}